package com.shawn.model.vo;

import com.shawn.model.entity.UserInfo;
import com.shawn.model.mongo.Dimension;
import com.shawn.model.mongo.Report;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author shawn
 * @date 2022年 11月 19日 15:15
 * 测试灵魂返回的结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SoulResultVo {
    private String conclusion;
    private String cover;
    private List<Dimension> dimensions;
    private List<UserVo> similarYou;

    public static SoulResultVo init(Report report , List<UserInfo> infos){
        SoulResultVo vo = new SoulResultVo();
        BeanUtils.copyProperties(report,vo);
        List<UserVo> userVos = infos.stream().map(info -> {
            UserVo userVo = new UserVo();
            BeanUtils.copyProperties(info, userVo);
            return userVo;
        }).collect(Collectors.toList());
        vo.setSimilarYou(userVos);
        return vo;
    }
}
